    <ul>
<?php for ($c=0;$c<$this->categories->length();$c++) { ?>
      <li>
        <div class="checkboxBox">
          <input type="checkbox" name="category[]" 
            id="category_<?= $this->categories->item($c)->_content_id ?>" 
            value="<?= $this->categories->item($c)->_content_id ?>"
            <?= in_array($this->categories->item($c)->_content_id,$this->checked_categories) ? ' checked="checked"' : '' ?>/>
        </div>
        <div class="labelBox">
          <label for="category_<?= $this->categories->item($c)->_content_id ?>"><?= $this->categories->item($c)->name ?></label>
          </div>
<?php if ($this->categories->item($c)->length()>0) {?>
<?= $this->partial('catalog/categorylink-list.phtml',
  	array(
  		'categories' => $this->categories->item($c),
  		'checked_categories' => $this->checked_categories
  	)) ?>
      </li>
<?php }?>
<?php } ?>
    </ul>